/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package class555gedcom;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringTokenizer;

/**
 *
 * @author Siva D
 */
class Dateformat implements Operations

{

    public void testValidity() {

        //do validity code
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void checkFormat() {
        //do format check code
        throw new UnsupportedOperationException("Not supported yet.");
    }
        public Date doDate(StringTokenizer st,int currlvl) {
        //do Date code
            String currtag = "DATE";
            System.out.print("within"+"\n"+currlvl);
            switch(currlvl){
case 0:
if(currtag.equals("HEAD") || currtag.startsWith("@I") || currtag.startsWith("@F")|| currtag.equals("TRLR"))
                 {}
                else
                     System.out.println("tag lvl number error 0");
break;
case 1:
                 if(currtag.equals("BIRT") || currtag.equals("NAME")|| currtag.equals("DEAT")|| currtag.equals("DIV")|| currtag.equals("MARR")|| currtag.equals("SEX"))
                 {

                 }
                else
                 {
                     System.out.println("tag lvl number error 1");
                 }
break;
case 2:
                 if(currtag.equals("DATE"))
                 {

                 }
                 else
                     System.out.println("tag lvl number error 2");
break;
              }


            String date=st.nextToken();
            String date1=st.nextToken();
            String date2=st.nextToken();
            String date3=date+" "+date1+" "+date2;
        DateFormat df=new SimpleDateFormat("dd MMM yyyy");
        @SuppressWarnings("deprecation")
        Date dat=new Date(date3);
        return dat;
    }

}
